<?php
require_once('system/project_settings.php');
//-------------------------------------------------

$pathinfo = pathinfo($_SERVER['REQUEST_URI']);
$oldLink = strlen($pathinfo['filename']) != 32;

$fname = '.' . $_SERVER['REQUEST_URI'];

if(!$oldLink) {
	$helper = ABSPATH . 'temp/sm_' . $pathinfo['filename'];
	$_SERVER['REQUEST_URI'] = @file_get_contents($helper);
}

ob_start();

$merger = new HTTP_StaticMerger( SECURITY_KEY );
$merger->main();

$content = ob_get_clean();
echo $content;

if(!$oldLink) {
	file_put_contents($fname, $content);
	@unlink($helper);
}